var provinces, cities, areas
if (document.domain.indexOf('bj') != -1) {
	provinces = {
		"name" : "北京",
		"value" : 36
	}
	cities = {
		"name" : "北京",
		"value" : 36
	}

} else if (document.domain.indexOf('tj') != -1) {
	provinces = {
		"name" : "天津",
		"value" : 37
	}
	cities = {
		"name" : "天津",
		"value" : 37
	}
} else if (document.domain.indexOf('hn') != -1) {
	provinces = {
		"name" : "海南",
		"value" : 1
	}
	cities = {
		"name" : "海南",
		"value" : 1
	}
} else if (document.domain.indexOf('cs') != -1) {
	provinces = {
		"name" : "长沙",
		"value" : 1
	}
	cities = {
		"name" : "长沙",
		"value" : 1
	}
} else if (document.domain.indexOf('sy') != -1) {
	provinces = {
		"name" : "沈阳",
		"value" : 1
	}
	cities = {
		"name" : "沈阳",
		"value" : 1
	}
} else if (document.domain.indexOf('sq') != -1) {
	provinces = {
		"name" : "商丘",
		"value" : 1
	}
	cities = {
		"name" : "商丘",
		"value" : 1
	}
}else{
	provinces = {
			"name" : "北京",
			"value" : 36
		}
		cities = {
			"name" : "北京",
			"value" : 36
		}
}

function renderProvinceOptions(nodeId) {
	$('#' + nodeId).append('<option value="' + provinces.value + '">' + provinces.name + '</option>')
}
function renderCityOptions(nodeId,cityParam) {
	httpClientForUpAdmin.del('/area/findCity/',null,function(data){
		$('#' + nodeId).append('<option value="">请选择</option>')
		if(data != ""){
			$.each(data, function(index, area) {
				if(cityParam && cityParam == area.id){
					$('#' + nodeId).append('<option value="' + area.id + '" selected>' + area.name + '</option>')
				}else{
					$('#' + nodeId).append('<option value="' + area.id + '">' + area.name + '</option>')
				}
			})
		}
	});
	
}
function renderAreaOptions(nodeId,areaParam,cityId) {
	var _cityid = cities.value;
	if(cityId!=null||cityId!=undefined) _cityid = cityId;
	httpClientForUpAdmin.del('/area/findArea/?parentId='+_cityid,null,function(data){
		$('#' + nodeId).append('<option value="">请选择</option>')
		if(data != ""){
			$.each(data, function(index, area) {
				if(areaParam && areaParam == area.id){
					$('#' + nodeId).append('<option value="' + area.id + '" selected>' + area.name + '</option>')
				}else{
					$('#' + nodeId).append('<option value="' + area.id + '">' + area.name + '</option>')
				}
			})
		}else{
			$('#' + nodeId).length=0;
		}
	});
	
}

function convertArea(nodeClass) {
	$.each($('.' + nodeClass), function(index, node) {
		var areaValue = $(node).attr('data-rel');
		$.each(areas, function(index, area) {
			if (areaValue == area.value) {
				$(node).text(area.name)
			}
		})
	})
}

function convertAreaWithCity(nodeClass) {
	$.each($('.' + nodeClass), function(index, node) {
		var areaValue = $(node).attr('data-rel');
		$.each(areas, function(index, area) {
			if (areaValue == area.value) {
				$(node).text(province.name + '-' + area.name)
			}
		})
	})
}